package com.qfjy.java2102.bean;

import com.qfjy.java2102.Enum.ResponseEnum;
import lombok.Data;
@Data
public class ResponseBody {
    /**
     * 响应状态码，
     */
    private String code;
    /**
     * 响应描述信息
     */
    private String msg;
    /**
     * 响应数据
     */
    private Object obj;

    public ResponseBody() {
    }

    public ResponseBody(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseBody(String code, String msg, Object obj) {
        this.code = code;
        this.msg = msg;
        this.obj = obj;
    }

    public static ResponseBody success() {
        return new ResponseBody(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getMsg());
    }

    public static ResponseBody success(Object obj) {
        return new ResponseBody(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getMsg(), obj);
    }

    public static ResponseBody failure() {
        return new ResponseBody(ResponseEnum.FAILURE.getCode(), ResponseEnum.FAILURE.getMsg());
    }
    public static ResponseBody failureCount() {
        return new ResponseBody(ResponseEnum.FAILURECOUNT.getCode(), ResponseEnum.FAILURECOUNT.getMsg());
    }
    public static ResponseBody failureUsername() {
        return new ResponseBody(ResponseEnum.FAILUREUSERNAME.getCode(), ResponseEnum.FAILUREUSERNAME.getMsg());
    }
    public static ResponseBody failurePassword() {
        return new ResponseBody(ResponseEnum.FAILUREPASSWORD.getCode(), ResponseEnum.FAILUREPASSWORD.getMsg());
    }
}
